layui.use('table', function() {
	var table = layui.table;
    
    
    
    var $ = layui.$, active = {
		reload: function() {
			var csLoding=layer.msg('数据加载中...', {
				icon: 16,
				shade: 0.3,
				success: function() {
					var mid = $('#mid').val();
					var mname = $('#mname').val();
					var level_id = $("#level_id option:selected").val();
					var start = $('#start').val();
					var end = $('#end').val();
		
					//执行重载
					table.reload('idTest', {
						page: {
							curr: 1 //重新从第 1 页开始
						},
						where: {
							key: {
								mid:mid,
								mname:mname,
								level_id:level_id,
								start: start,
								end: end
							}
						},
						done: function(){
						     layer.close(csLoding)
						}
					});
				}
			})
			
		}
	 }
	$('.right-center #ScreenBnt').on('click', function() {
		var type = $(this).data('type');
		active[type] ? active[type].call(this) : '';
	});
    
    
	var csLoding=layer.msg('数据加载中...', {
		icon: 16,
		shade: 0.3,
		success: function() {
			table.render({
				elem: '#centet-cen',
				url: listSrc,
				height: $(".center-tab").height(),
				id: 'idTest',
				response: {
		  			statusCode: 1, //成功的状态码，默认：0
				},
				page:true,
				cols: [
					[ //标题栏
					
						{
							field: 'id',
							title: 'ID'
						}, {
							field: 'mid',
							title: '用户编号'
						}, {
							field: 'mname',
							title: '姓名'
						}, {
							field: 'floor',
							title: '层数'
						}, {
							field: 'area_remark',
							title: '大区'
						}, {
							field: 'type_remark',
							title: '类型'
						}, {
							field: 'status_remark',
							title: '状态'
						}, {
							field: 'level_name',
							title: '当前等级'
						}, {
							field: 'init_level_name',
							title: '最初等级'
						}, {
							field: 'inviter_mid',
							title: '推荐人'
						}, {
							field: 'seter_mid',
							title: '安置人'
						}, {
							field: 'agent_mid',
							title: '代理中心'
						}
					]
				],
				limit: 20,
				done:function(){
					layer.close(csLoding);
				}
			});
					
		}

	})

})
layui.use(['form', 'layedit', 'laydate'], function(){
	 var form = layui.form,layer = layui.layer,layedit = layui.layedit,laydate = layui.laydate;
	laydate.render({
		elem: '#start'
	});
	laydate.render({
		elem: '#end'
	});
})

$(function(){
	
	
	//会员等级
	levelFun();
	
	
})